<div class="portlet-content">           

  <div class="table-responsive">

    <h4 class="heading"><?php echo $exemple->intitule(); ?></h4> 
    <form action='partie_save.php' method='post' id="partie-save">     
     <div class="row" align="center">
     <div class="col-lg-2"><input type="submit" value="TERMINER L'EXERCICE" /></div>
     <?php if(isset($_GET['ex'])){ ?>
     <div class="col-lg-2"><input type="text" name="minutes" id="minutes" /> minutes</div>
     <div class="col-lg-2"><input type="text" name="secondes" id="secondes" /> secondes</div>
     <?php } ?>
     </div>
     <input type="text" name="idRefTest" value="<?php echo $acces->idRefTest(); ?>" hidden/>
	 <input type='text' name='idExercice' value='<?php echo $exemple->id(); ?>' hidden/>
    <hr/>        
                                
    <ul id="myTab1" class="nav nav-tabs">
        <?php
            for($i=1;$i<=$exercicemanager->getNbQuestion($exemple->id());$i++){
                if($i==1){$type = "class='active'";}else{$type = "";}
                echo"
                <li ".$type."'>
                  <a href='#".$i."' data-toggle='tab'>".$i."</a>
                </li>";						
            }
        ?>
        
    </ul>

    <div id="myTab1Content" class="tab-content">

        <?php
        
        for($i=1;$i<=$exercicemanager->getNbQuestion($exemple->id());$i++){
            $TabQuest = $questionmanager->getByExercice($exemple->id());
            $TabRep = $reponsemanager->getByQuestion($TabQuest[$i-1]->id());
            if($i==1){$type = "class='tab-pane fade in active'";}else{$type = "class='tab-pane fade'";}
            
                if (file_exists($TabQuest[$i-1]->image())){ // on regarde si c'est une image ou non
                    $QImage =  "<img src='".$TabQuest[$i-1]->image()."' width=500px />";
                }
                else{$QImage = "Aucune Image";}						
                ?>
                <div <?php echo $type; ?> id='<?php echo $i; ?>'>
                    <p>Question "<?php echo $i; ?>" :</p>
                <?php echo	"<p>".$TabQuest[$i-1]->contenu()."<br/>"
                        .$QImage."
                    </p>
                    

                    <p>Nombre de réponses : ".$questionmanager->getNbReponse($TabQuest[$i-1]->id())."</p>"; ?>
                    
                    <table border='1' >

                    <?php	
                    for($j=0;$j<$questionmanager->getNbReponse($TabQuest[$i-1]->id());$j++){
                        
                        
                        ////////////////////////////////////
                        if (file_exists($TabRep[$j]->image())){ // on regarde si c'est une image ou non
                            $LImage =  "<img src='".$TabRep[$j]->image()."' width=100px/>";
                        }
                        //
                        else{$LImage = "Aucune Image";}	
                        
                        
                        
                        
                        
                        if($TabRep[$j]->contenu() === "NoText"){ // on regarde s'il y a une réponse
                            $LeContenu = "Aucun Text";
                        }
                        else{
                            $LeContenu = $TabRep[$j]->contenu();
                        }
                        ////////////////////////////////////
                        
						//Si c'est un exemple, affiché les réponses
						$checked = "";
						if(!isset($_GET['ex']))
						{
							$repJuste = $reponsemanager->getJuste($TabQuest[$i-1]->id());
							foreach($repJuste as $repJ)
							{
								if($LeContenu == $repJ->contenu())
								{
									$checked = " checked";
								}
							}
						}

						echo "
                            
                                <tr>
                                    <td style='padding:3px'>
                                        <input type='checkbox' name='repCheck".$TabRep[$j]->id()."' value='".$TabRep[$j]->id()."'".$checked." />
                                    </td>										
                                    <td style='padding:3px'>
                                        ".$LImage."
                                    </td>
                                    <td style='padding:3px'>
                                        ".$LeContenu."
                                    </td>
                                </tr>
                            ";
                    } ?>
        
                    </table>							
                </div>
            
<?php	} ?>
        
        
    </div>
    
        </form>

  </div> <!-- /.table-responsive -->

</div> <!-- /.portlet-content -->